home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 426-450 / disk_436 / keymacro / preinclude.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  4KB  |  176 lines

  1. /****************************************************************************
  2. *
  3. *    KeyMacro.h ------------    KeyMacro main include file.
  4. *
  5. *    Author ----------------    Olaf Barthel, MXM
  6. *                Brabeckstrasse 35
  7. *                D-3000 Hannover 71
  8. *
  9. *    KeyMacro  ©  Copyright  1990  by  MXM;  Executable  program,
  10. *    documentation  and  source  code are shareware.  If you like
  11. *    this  program  a  small donation will entitle you to receive
  12. *    updates and new programs from MXM.
  13. *
  14. ****************************************************************************/
  15.  
  16. #ifndef KEYMACRO_H
  17. #define KEYMACRO_H 1
  18.  
  19. #define __NO_PRAGMAS 1
  20.  
  21.     /* Standard include files. */
  22.  
  23. #include <intuition/intuitionbase.h>
  24. #include <libraries/dosextens.h>
  25. #include <workbench/workbench.h>
  26. #include <devices/inputevent.h>
  27. #include <libraries/arpbase.h>
  28. #include <workbench/startup.h>
  29. #include <graphics/gfxbase.h>
  30. #include <exec/interrupts.h>
  31. #include <devices/console.h>
  32. #include <devices/conunit.h>
  33. #include <devices/keymap.h>
  34. #include <devices/timer.h>
  35. #include <exec/execbase.h>
  36. #include <devices/input.h>
  37. #include <exec/memory.h>
  38.  
  39. #include <clib/intuition_protos.h>
  40. #include <clib/graphics_protos.h>
  41. #include <clib/console_protos.h>
  42. #include <clib/exec_protos.h>
  43. #include <clib/alib_protos.h>
  44. #include <clib/dos_protos.h>
  45.  
  46. #include <stdlib.h>
  47. #include <string.h>
  48. #include <stdio.h>
  49. #include <ctype.h>
  50.  
  51.     /* Name of global MsgPort and program revision. */
  52.  
  53. #define PORTNAME    "KeyMacro"
  54. #define REVISION    8
  55.  
  56.     /* Signal flag names. */
  57.  
  58. #define SIG_CLOSE    SIGBREAKF_CTRL_C
  59. #define SIG_PORT    (1 << SigBit)
  60. #define SIG_SHAKE    SIGBREAKF_CTRL_F
  61.  
  62.     /* MacroKey tag IDs */
  63.  
  64. #define MK_UNUSED    0
  65. #define MK_WORD        1
  66. #define MK_COMMAND    2
  67.  
  68.     /* MacroMessage tad IDs */
  69.  
  70. #define MM_INPUT    0
  71. #define MM_UPDATE    1
  72. #define MM_EXECUTE    2
  73.  
  74.     /* Maximum number of key macros. Change this if you prefer
  75.      * more of less.
  76.      */
  77.  
  78. #define MAXMACROS    30
  79.  
  80.     /* KeyMacro InputEvent subclass. */
  81.  
  82. #define KM_SUBCLASS    97
  83.  
  84.     /* Values for non-ASCII key codes. */
  85.  
  86. #define KC_CURSORUP    140
  87. #define KC_CURSORDOWN    141
  88. #define KC_CURSORRIGHT    142
  89. #define KC_CURSORLEFT    143
  90.  
  91. #define KC_FKEY1    129
  92. #define KC_FKEY2    130
  93. #define KC_FKEY3    131
  94. #define KC_FKEY4    132
  95. #define KC_FKEY5    133
  96. #define KC_FKEY6    134
  97. #define KC_FKEY7    135
  98. #define KC_FKEY8    136
  99. #define KC_FKEY9    137
  100. #define KC_FKEY10    138
  101.  
  102. #define KC_HELP        139
  103.  
  104.     /* ToUpper macro, will also handle international characters. */
  105.  
  106. #define ToUpper(c)    (((c >= 224 && c <= 254) || (c >= 'a' && c <= 'z')) ? c - 32 : c)
  107.  
  108.     /* Allocate public memory. */
  109.  
  110. #define AllocPub(Size)    AllocRem(Size,MEMF_PUBLIC | MEMF_CLEAR)
  111.  
  112.     /* A keyboard alias, includes a name string and a value
  113.      * to be used as an equivalent.
  114.      */
  115.  
  116. struct KeyAlias
  117. {
  118.     char    *ka_Name;
  119.     UWORD     ka_Key;
  120. };
  121.  
  122.     /* A MacroKey structure. */
  123.  
  124. struct MacroKey
  125. {
  126.     UBYTE     mk_Type;        /* Type of macro key. */
  127.  
  128.     UBYTE     mk_CommandKey;        /* Key to call this macro. */
  129.     UWORD     mk_CommandQualifier;    /* Qualifier needed to hold while pressing the key. */
  130.  
  131.     UBYTE    *mk_String;        /* String to be entered/Name of command to be executed. */
  132.     UBYTE    *mk_Window;        /* Name of window to look for. */
  133. };
  134.  
  135.     /* A MacroMessage structure. */
  136.  
  137. struct MacroMessage
  138. {
  139.     struct Message     mm_Message;    /* Standard Exec message. */
  140.  
  141.     UBYTE         mm_Type;    /* Message type. */
  142.  
  143.     struct MacroKey    *mm_MacroKey;    /* A list of macro keys. */
  144.  
  145.     LONG         mm_NumMacros;    /* Number of macros to follow. */
  146.     struct MacroKey    *mm_MacroList;    /* A list of macros to add to the list. */
  147.  
  148.     UBYTE        *mm_FileName;    /* A file to execute. */
  149.     UBYTE        *mm_WindowName;    /* A window title to look for. */
  150. };
  151.  
  152.     /* A MSeg structure, basically an extended MsgPort. */
  153.  
  154. struct MSeg
  155. {
  156.     struct MsgPort     Port;        /* Standard Exec MsgPort. */
  157.  
  158.     BPTR         Segment;    /* Pointer to handler segment. */
  159.     LONG         SegSize;    /* Length of MSeg structure. */
  160.  
  161.     UBYTE         Revision;    /* Handler revision. */
  162.  
  163.     struct Task    *Father;    /* Calling task. */
  164.     struct Task    *Child;        /* Waiting task. */
  165.  
  166.     ULONG         RingBack;    /* Global wait signal. */
  167.  
  168.     LONG         NumMacros;    /* Number of macros in list. */
  169.     struct MacroKey    *MacroList;    /* A list of macro keys. */
  170.  
  171.     struct KeyMap    *DefaultKeyMap;    /* Default keymap used for key translation. */
  172.     LONG         Delay;        /* Key event delay in micro seconds. */
  173. };
  174.  
  175. #endif    /* KEYMACRO_H */
  176.